using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;

namespace Axe.Data.Mapping
{
    /*
    public partial class SqlObjectWrapper<T> where T : class
    {
        private string m_ConnectionString;
        readonly SqlObjectMapper<T> m_Mapper;

        #region public string ConnectionString
        public string ConnectionString
        {
            get { return m_ConnectionString; }
            set { m_ConnectionString = value; }
        }
        #endregion

        public SqlObjectWrapper(SqlObjectMapper<T> mapper)
        {
            if (mapper == null)
                throw new ArgumentNullException("mapper");

            m_Mapper = mapper;
        }

        public SqlObjectWrapper(SqlObjectMapper<T> mapper, string connectionString)
        {
            m_Mapper = mapper;
            m_ConnectionString = connectionString;
        }

        private SqlConnection CreateConnection()
        {
            return new SqlConnection(m_ConnectionString);
        }

        #region IMappedObjectAdapter<T> Members

        public CommandResult Update(T obj)
        {
            using(SqlConnection conn = CreateConnection())
            {
                return m_Mapper.Update(obj, conn, true,null);
            }
        }

        public CommandResult Delete(params Clause[] clauses)
        {
            using (SqlConnection conn = CreateConnection())
            {
                return m_Mapper.Delete(conn, true, null, clauses);
            }
        }

        public List<T> Select(params Clause[] clauses)
        {
            using (SqlConnection conn = CreateConnection())
            {
                return m_Mapper.Select(conn, true, null,clauses);
            }
        }

        public CommandResult Insert(T obj)
        {
            using (SqlConnection conn = CreateConnection())
            {
                return m_Mapper.Insert(obj, conn, true, null);
            }
        }

        public CommandResult Delete(T obj)
        {
            using(SqlConnection conn = CreateConnection())
            {
                return m_Mapper.Delete(conn, true, obj, null);
            }
        }

        public List<T> SelectAll()
        {
            using(SqlConnection conn = CreateConnection())
            {
                return m_Mapper.Select(conn, true, null, null);
            }
        }
        public List<T> SelectAll(int pageIndex, int pageSize, out int totalRecords)
        {
            using (SqlConnection conn = CreateConnection())
            {
                return m_Mapper.Select(conn, true,null,pageIndex, pageSize, out totalRecords,null);
            }
        }
        public T Select(object primaryKey)
        {
            using (SqlConnection conn = CreateConnection())
            {
                return m_Mapper.Select(conn, true, null, primaryKey);
            }
        }

        public List<T> Select(int pageIndex, int pageSize, out int totalRecords, params Clause[] clauses)
        {
            using (SqlConnection conn = CreateConnection())
            {
                return m_Mapper.Select(conn, true, null, pageIndex, pageSize, out totalRecords, clauses);
            }

        }

        #endregion
    }
     * */
}
